package com.tuomaxu.utils;

import com.tuomaxu.annotation.Autowired;
import com.tuomaxu.annotation.Component;

@Component
public class TransactionManager {

    @Autowired
    private ConnectionUtils connectionUtils;

    public void begin() throws Exception {
        connectionUtils.getCurrentThreadConn().setAutoCommit(false);
    }

    public void commit() throws Exception {
        connectionUtils.getCurrentThreadConn().commit();
    }

    public void rollback() throws Exception {
        connectionUtils.getCurrentThreadConn().rollback();
    }
}
